from django.core.management.base import BaseCommand
from product.service.product_generate_service import ProductIvtGen
from utils.IOService import WriteFrame

class Command(BaseCommand):
    help = '生成商品库存数据'

    # def add_arguments(self, parser):
    #     parser.add_argument('--threads', type=int, default=4, help='线程数量')

    def handle(self, *args, **options):
        # thread_count = options['threads']

        generator = ProductIvtGen()
        # wf = WriteFrame(generator)
        inserted_count = generator.batch_insert()

        self.stdout.write(
            self.style.SUCCESS(f'成功生成并插入 {inserted_count} 条库存记录')
        )